import 'package:flutter/material.dart';
import 'package:get/get.dart';

class MaintabController extends GetxController {
  MaintabController();

  var currentIndex = 0;
  late PageController pageController;

  _initData() {
    update(["maintab"]);
  }

  void onTap() {}

  void changeItem(int idx) {
    if (idx == currentIndex) {
      return;
    }
    currentIndex = idx;
    pageController.jumpToPage(idx);
    _initData();
  }

  @override
  void onInit() {
    super.onInit();
    pageController = PageController(initialPage: currentIndex);
  }

  @override
  void onReady() {
    super.onReady();

    _initData();
  }

  // @override
  // void onClose() {
  //   super.onClose();
  // }
}
